<template>
	<div class="category">
		<div class="box">
			<div class="item" v-for="(item, index) in list" :key="index" @click='fenbie(item)'>
				<div class="text">{{item.category_name}}</div>
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				require: true,
			},
			type: {
				type: String,
				require: true,
			},
		},
		data() {
			return {}
		},
		methods: {
			fenbie(item) {
				let id = item.id;
				let type = this.type;
				uni.navigateTo({
					url: '/pages/search/index?id=' + id + "&type=" + type,
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.category {
		background-color: #fff;
		height: 90px;
		position: relative;

		.box {
			// width: 100%;
			position: absolute;
			bottom: 20px;
			left: 10px;
			right: 10px;
			box-shadow: 0 0 11px -7px #000;
			height: 100px;
			border-radius: 10px;
			background-color: #fff;
			overflow: hidden;
			flex-wrap: wrap;
			display: flex;

			.item {
				width: 25%;
				height: 50px;
				display: flex;
				align-items: center;
				justify-content: center;
				position: relative;
				color: #000;
				font-size: 14px;
				padding: 0 10px;
				box-sizing: border-box;

				.text {
					white-space: nowrap;
					overflow: hidden;
					text-overflow: clip;
				}

				&::before {
					content: "";
					display: block;
					position: absolute;
					top: 0;
					bottom: 0;
					left: 0;
					margin: auto;
					width: 1px;
					height: 20px;
					background-color: #e2e2e2;
				}
			}
		}
	}
</style>